//
//  YMTempretureCell.m
//  YMCommentDemo
//
//  Created by lantaiyuan on 2017/2/25.
//  Copyright © 2017年 lantaiyuan. All rights reserved.
//

#import "YMTempretureCell.h"

#define Line_grayColor HEX(@"#BBBBBB")

@interface YMTempretureCell ()
@property (nonatomic, weak) IBOutlet UIView *leftView;
@property (nonatomic, weak) IBOutlet UIView *rightView;
@property (nonatomic, weak) IBOutlet UIImageView *bigImageView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nodeHeightWithConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nodeWidthWithConstraint;
@end

@implementation YMTempretureCell
{
    UIColor * selColor;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setType:(NSInteger)type{
    switch (type) {
        case YMCommentContentViewTypeTempreture:
        {
            selColor = HEX(@"#5DA7FA");
        }
            break;
        case YMCommentContentViewTypeCrown:
        {
            selColor = HEX(@"#fb6a67");
        }
            break;
        case YMCommentContentViewTypeClean:
        {
            selColor = HEX(@"#d163f9");
        }
            break;
            
        default:
            break;
    }
}

- (void)showSelNode:(BOOL)show
       nodeSelImage:(NSString *)image isSmall:(BOOL)isSmall
           leftShow:(BOOL)leftShow
            leftSel:(BOOL)leftSel
          rightShow:(BOOL)rightShow
           rightSel:(BOOL)rightSel
{
    _leftView.hidden = !leftShow;
    _leftView.backgroundColor = leftSel ? selColor : Line_grayColor;
    
    _rightView.hidden = !rightShow;
    _rightView.backgroundColor = rightSel ? selColor : Line_grayColor;
    
    
    _bigImageView.image = [UIImage imageNamed:image];
    
    if (isSmall) {
        _nodeWidthWithConstraint.constant = 15;
        _nodeHeightWithConstraint.constant = 15;
    }else{
        _nodeWidthWithConstraint.constant = 45;
        _nodeHeightWithConstraint.constant = 45;
    }
}
@end
